using ServiceStack.Model;
using System;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace ServiceStack
{
	internal static class HasId<TEntity>
	{
		[CompilerGenerated]
		[Serializable]
		private sealed class <>c
		{
			public static readonly HasId<TEntity>.<>c <>9 = new HasId<TEntity>.<>c();
			internal bool cctor>b__1_0(Type t, object critera)
			{
				return t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IHasId<>);
			}
		}
		private static readonly Func<TEntity, object> GetIdFn;
		static HasId()
		{
			Type type = typeof(TEntity).FindInterfaces(new TypeFilter(HasId<TEntity>.<>c.<>9.<.cctor>b__1_0), null)[0].GetGenericArguments()[0];
			Type arg_7A_0 = typeof(HasIdGetter<, >).MakeGenericType(new Type[]
			{
				typeof(TEntity),
				type
			});
			ParameterExpression parameterExpression;
			HasId<TEntity>.GetIdFn = Expression.Lambda<Func<TEntity, object>>(Expression.Call(arg_7A_0, "GetId", new Type[0], new Expression[]
			{
				parameterExpression
			}), new ParameterExpression[]
			{
				parameterExpression
			}).Compile();
		}
		public static object GetId(TEntity entity)
		{
			return HasId<TEntity>.GetIdFn(entity);
		}
	}
}
